home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Games of Daze
/
Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso
/
x2ftp
/
msdos
/
math
/
daubwave
/
daubwave.doc
< prev
next >
Wrap
Text File
|
1993-01-14
|
36KB
|
974 lines
DAUBWAVE.DOC - This file contains the documentation for the program
DAUBWAVE.EXE.
Written by Steven Gollmer, October 28, 1992
Introduction.............................................2
DAUBWAVE.................................................3
I. Options........................................3
A. Default....................................3
B. Output, -o <filename>......................4
C. Wavelet Function, -d#......................4
D. Normalization, -n#.........................4
E. Actions....................................4
1) Transform, -t#........................4
2) Inverse, -i#..........................4
3) Series, -s#...........................4
4) Low Pass Filter, -l#..................5
5) High Pass Filter, -h#.................5
6) Band Pass Filter, -b#.................5
7) Notch Filter, -k#.....................5
F. Other......................................5
1) Rotate, -r............................5
2) Shift by 1, -1........................5
3) Unix Redirection, -u..................5
4) Compression, -c.......................5
II. Examples.......................................6
A. Default....................................6
B. Output, -o <filename>......................6
C. Wavelet Function, -d#......................6
D. Normalization, -n#.........................7
E. Actions...............................8
1) Transform, -t#........................8
2) Inverse, -i#..........................9
3) Series, -s#...........................9
4) Low Pass Filter, -l#..................10
5) High Pass Filter, -h#.................10
6) Band Pass Filter, -b#.................11
7) Notch Filter, -k#.....................12
F. Other......................................12
1) Rotate, -r............................12
2) Shift by 1, -1........................13
3) Unix Redirection, -u..................13
4) Compression, -c.......................13
III. Program Cautions...............................13
A. Round Off Error............................13
B. Zero Padding...............................14
C. Wrap Around................................14
D. Option Usage...............................14
Conclusion...............................................14
1
Introduction
This program is made available as is. The author is not liable for any
damage to hardware or data due to the use of this program. If there are
problems, I would like to help you, but I can not be responsible for problems
that may occur on machines that I have not tested this program nor for uses
of this program in combination with other programs. This program may be
modified and used for personal use, but any distribution of original code or
modifications of original code can not be made without the author's consent.
Money may not be collected for distributing this code apart from the amount
needed to provide the media, shipping and a modest processing fee.
Files included in this release of DAUBWAVE are as follows.
DAUBWAVE.EXE - Program to run under MSDOS
DAUBWAVE.DOC - Documentation on program's options
DAUBWAVE.C - Code for this program. ANSI C version is also available
The purpose of this program is to perform wavelet based operations on a
data set. It should be useful in learning orthogonal wavelet analysis as
well as data analysis using orthogonal wavelets. This program uses
orthogonal wavelet analysis based on Daubechies' derived coefficients.
References which may be useful in understanding my code would be as follows.
Daubechies, I., 1988: Commun. Pure and Appl. Math., vol. 41, pp. 909-996.
Mallat, S.G., 1989: IEEE Trans. on Pattern Analysis and Machine
Intelligence, vol. 11, pp. 674-693.
Press, William H., 1992: 'Numerical Recipes for Fortran, 2nd Ed. New York:
Cambridge University Press.
Strang, G. 1989: SIAM Review, vol. 31, pp. 614-627.
I do not want to give a thorough discussion of orthogonal wavelets here,
but I do need to clarify a few concepts. The orthogonal wavelet transform
decomposes a data set onto an orthogonal basis set. This orthogonal basis
set consists of a fundamental wavelet which is translated by steps of 2 and
scaled by factors of 2. A single coefficient is calculated as an inner
product of a wavelet vector with a data vector. A series of coefficients are
generated by applying the inner product N/2 times, shifting the wavelet
vector by 2 positions each time. N is the number of points within the data
set. The wavelet function extracts information about differences between
adjacent positions within the data. A companion function which retains
information about the averages between adjacent points is the scale function
and it is applied in the afore mentioned way to generate a second series of
coefficients. These two series of coefficients are each half as long as the
original data set. The one series corresponds to the coefficients generated
from inner products with the scale function which will be designated the
'smoothed' data. The second series corresponds to the coefficients generated
from the inner products with the wavelet function which will be designated
the 'detail' of the data. Therefore, an original data set of 1024 values
will be decomposed into two series of 512 values. When the results are saved
to a file, the smoothed data is saved first followed by the detail of the
data. This transform will be called a first level transform and it only
applies the wavelet function at the smallest scale. If the above analysis is
done along with an analysis using the function expanded by a factor of two,
the results will be called a second level transform. From multiresolution
2
analysis, the transform using a wavelet expanded by a factor of 2 is the same
as applying the original wavelet transform to the smoothed data of the first
level transform. When a second level transform is performed there are three
series of results. The following diagram illustrates the notation and the
relationship of levels of the analysis to the transformed data.
o0 o1 o2 o3 o4 o5 o6 o7 (original)
s0 s1 s2 s3 d0 d1 d2 d3 (level 1)
ss0 ss1 sd0 sd1 d0 d1 d2 d3 (level 2)
sss0 ssd0 sd0 sd1 d0 d1 d2 d3 (level 3)
d - detail of the data
s - smoothed data
# - indicates the position within a particular series of results
The order of the 's's and 'd's indicates the processes that have been applied
to the original data to get the corresponding coefficient. For ssd the data
has been transformed three times. The first time the scaling
function(smoothing) was applied, next the 2X scaling function(smoothing at
larger scale) was applied and finally the four times wavelet function(detail
at the largest scale) was applied. Notice that once the detail of the data
has been calculated no further transform is performed on it. The transform
can be taken to some maximum level, Y, as long as the original data has a
length of 2 to the Yth power. The advantage of the orthogonal wavelet
transform is that all of the information of the original data set is retained
and can be used to reconstruct the original data set.
DAUBWAVE
This program performs a number of different functions which are all based on
the wavelet transform. The first section summarizes each option. This is
followed by a section giving examples of these options. Finally some
comments are made about various idiosyncrasies of this implementation of the
wavelet transform.
I. Options
The order of discussion has been chosen to place the emphasis on the most
important and useful functions first followed by more specialized options
available in the program.
A. Default
The program DAUBWAVE will work as long as an input file name is given after
the program name. The file is assumed to be sequential floating point
numbers separated by any white space. The program will use a default wavelet
function of D4. The default normalization will apply the square root of two
on both the forward and the inverse transform. The default action taken is
the forward wavelet transform and this transform will be performed to the
maximum number of levels possible. The output file will consist of floating
point numbers placed on separate lines and the file name will be generated
using the rules discussed in the next section.
3
B. Output, -o <filename>
The output file name can be explicitly set by using the -o option. If only
the root name of the file is specified, the extension of the file will be
determined from three option settings within the program. The first is the
particular action taken. If a forward transform is performed then the first
character in the extension will be a 't'. The second is the particular
wavelet function used. If the D4 wavelet is used, then the second character
in the extension will be a '4'. The last character will indicate the number
of levels to which the action was taken. If the action was taken to the 5th
level then the last character of the extension would be '5'. If the -o
option is not given, the root name of the output file is the same as the root
of the input file.
C. Wavelet Function, -d#
The wavelet function can be set using the -d# option. The value of # must an
even number between 2 and 20. This will give orthogonal wavelets ranging
from D2 (Haar wavelet) to D20. Daubechies' orthogonal wavelets of higher
order are not incorporated into this program. The default wavelet is D4.
D. Normalization, -n#
The normalization process for the wavelet transform involves a factor of 1/2.
This can be applied either on the forward transform or the inverse transform.
The normalization options available in this program are to divide by two only
on the inverse transform (# = 1), to divide both the forward and inverse
transform by the square root of two (# = 2) or to divide by two only on the
forward transform (# = 3). The default value is (# = 2)
E. Actions
All of the actions described in this section can have a number following
them. # is the level to which the action is to be taken. If # is not
specified then DAUBWAVE will perform the transform to the maximum number of
levels possible as determined by the length of the data set. The default
action is -t.
1) Transform, -t#
This option performs a forward wavelet transform on the data. Once this is
done the results are saved to the output file.
2) Inverse, -i#
This option performs only the inverse wavelet transform on the data. Once
this is done the results are saved to the output file.
3) Series, -s#
This option is the same as the -t# option except the results from each level
of the forward transform are saved as separate files. The extension of the
output file name is different from the procedure mentioned previously.
Instead of the first character indicating the action taken, it is now the
highest level to which the transform is taken. The second character still
indicates the wavelet function used; however, the last character indicates
which level of the transform is saved to this file. The smoothed results
from the highest level of the transform will use a level of '0'. The detail
results from the highest level of the transform will use '1'. The file with
the third character matching the first character in the file extension will
4
contain the detail results from the first pass of the forward transform.
Since more than one file will be generated with this option, it is
incompatible with the -o option where the full filename is specified.
4) Low Pass Filter, -l#
This option performs the forward transform and then sets all of the detail
results to zero. The inverse transform is then performed and the results are
sent to the output.
5) High Pass Filter, -h#
This option performs the forward transform and then sets all of the smoothed
results to zero. The inverse transform is then performed and the results are
sent to the output.
6) Band Pass Filter, -b#
This option performs the forward transform and then sets the smoothed results
to zero along with any detail results which were generated before the last
level of the transform. The inverse transform is then performed and the
results are sent to the output.
7) Notch Filter, -k#
This option performs the forward transform and then sets the detail results
of the last level of the transform to zero. The inverse transform is then
performed and the results are sent to the output.
F. Other
These options are not applied as a default. They must be specified if they
are to take affect.
1) Rotate, -r
When working with higher order Daubechies wavelets, the main weighting of the
function does not correspond with the zero point of the x-axis. This makes
it difficult to match features in the analysis with features of the original
data set. This option rotates both the smoothed and detail results so as to
get correspondence between features.
2) Shift by 1, -1
Since the wavelet transform begins its operations only on even data
positions, calculations starting on odd points are ignored. Though this
information is redundant for purposes of reconstructing the original data
set, it is different from the calculations done on even points. This option
shifts the starting point of the wavelet transform by one point, thus
allowing the transform to begin its operations on odd data positions.
3) Unix Redirection, -u
With certain applications it is beneficial to use unix style redirection of
input and output. This option forces the program to receive input for the
standard input and send the results to the standard output.
4) Compression, -c
On machines that support ANSI C the use of binary input and output are
allowed. In this case it is more efficient to use the IEEE binary floating
point format. This not only saves space but also retains the precision of
the original numbers. When this option is specified, the input and output
5
files are opened as binary files and assumed to be in IEEE floating point
format. This option may not be available on the distributed code due to
incompatibilities. If you want to use this option contact me and I can send
code which can make this option available.
II. Examples
The following examples are given to illustrate the different options
available with DAUBWAVE. The different results are based on an initial data
file of length 8 named TEST.DAT.
TEST.DAT
2.0 4.0 6.0 8.0 1.0 3.0 5.0 7.0
When an example is given, it will consist of three lines. The first is the
command given to the computer. The second is the name of the file that is
generated by the computer. The third line is the data contained within this
file.
A. Default
The file TEST.T43 is obtain when the default options are used.
DAUBWAVE TEST.DAT
TEST.T43
12.7279 1.0953 -3.9886 -2.9396 0 -3.1820 0 -2.4749
The root of the output file is the same as that of the input file. The
extension indicates that the forward transform was performed using the D4
wavelet and the transform was performed to three levels. This is the maximum
number allowed since the data set is only 8 points long. The same result
would have been obtained with the following options explicitly listed.
DAUBWAVE TEST.DAT -d4 -n2 -t
B. Output, -o <filename>
Specifying the output file name is done with this option. To have the output
sent to the file DATA.OUT use the following command.
DAUBWAVE TEST.DAT -o DATA.OUT
DATA.OUT
12.7279 1.0953 -3.9886 -2.9396 0 -3.1820 0 -2.4749
If only the root is specified the extension will be generated using the
action type, wavelet type and number of levels.
DAUBWAVE TEST.DAT -o DATA
DATA.T43
12.7279 1.0953 -3.9886 -2.9396 0 -3.1820 0 -2.4749
C. Wavelet Function, -d#
The possible wavelet functions available in this program are D2 through D20.
Examples of each of these functions follows.
DAUBWAVE TEST.DAT -d2
6
TEST.T23
12.7279 1.4142 -4 -4 -1.4142 -1.4142 -1.4142 -1.4142
DAUBWAVE TEST.DAT -d4
TEST.T43
12.7279 1.0953 -3.9886 -2.9396 0 -3.1820 0 -2.4749
DAUBWAVE TEST.DAT -d6
TEST.T63
12.7279 0.3698 -1.3303 -2.9942 -4.2680 1.0860 -3.3196 0.8447
DAUBWAVE TEST.DAT -d8
TEST.T83
12.7279 -0.4491 -1.2846 0.3577 1.5696 -3.7826 1.2208 -4.6646
DAUBWAVE TEST.DAT -d10
TEST.TA3
12.7279 -1.0799 1.7935 0.7742 -3.7172 1.1383 -4.4688 1.3908
DAUBWAVE TEST.DAT -d12
TEST.TC3
12.7279 -1.3266 2.7453 2.7759 0.6061 -3.8063 0.6592 -3.1158
DAUBWAVE TEST.DAT -d14
TEST.TE3
12.7279 -1.1259 3.2257 4.2041 -2.8123 -0.4342 -2.1134 -0.2969
DAUBWAVE TEST.DAT -d16
TEST.TG3
12.7279 -0.5581 4.8306 3.1613 -1.6783 -0.9271 -1.4059 -1.6456
DAUBWAVE TEST.DAT -d18
TEST.TI3
12.7279 0.1846 2.6627 4.4807 0.2106 -2.5053 -0.4923 -2.8698
DAUBWAVE TEST.DAT -d20
TEST.TK3
12.7279 0.8614 3.2201 1.8394 -3.3837 0.4552 -3.8266 1.0983
One thing to note in the output file's extension is that when numbers are
larger than 9 an alphabetic designation is used. This is similar to
hexadecimal notation except it extends beyond 'F = 15'. Therefore, the
highest wavelet possible, D20, will cause the 2nd value of the extension to
be 'K'.
The noted similarity between each of these results is that the first value is
12.7279. This number is equal to the average of the whole data set
multiplied by the square root of 2 to the power 3, where 3 is the number of
levels of the analysis.
D. Normalization, -n#
To adjust the type of normalization incorporated, the -n# option is used.
There are three ways the normalization have been implemented in this program.
The first is to apply the normalization on the inverse transform only. When
7
the transform is done to the maximum level, Y, the first value of the result
will be the average of the data set times two to the Y power.
DAUBWAVE TEST.DAT -n1
TEST.T43
36 3.0981 -7.9772 -5.8792 0 -4.5 0 -3.5
The second is to divide both the forward and inverse transform by the square
root of two. When the transform is done to the maximum level, Y, the first
value of the result will be the average of the data set times the square root
of two taken to the Y power.
DAUBWAVE TEST.DAT -n2
TEST.T43
12.7279 1.0953 -3.9886 -2.9396 0 -3.1820 0 -2.4749
The third is to divide the forward transform by two. When the transform is
done to the maximum level, Y, the first value of the result will be the
average of the data set.
DAUBWAVE TEST.DAT -n3
TEST.T43
4.5 0.3873 -1.9943 -1.4698 0 -2.25 0 -1.75
One word of warning about the normalization scheme. If you do a multiple
level transform with one normalization and do the inverse with a different
normalization you will not end up with a result which is a simple
multiplication by a normalization factor. Rather you will have a mixing of
normalization factors at different scales giving you a non-linear combination
of the normalization factors.
E. Actions
1) Transform, -t#
The option -t indicates that the forward transform of the data is to be
taken. The transform can be taken to any number of levels up to its maximum
which is determined by the length of the data set. The simplest form of this
option is as follows.
DAUBWAVE TEST.DAT -t
TEST.T43
12.7279 1.0953 -3.9886 -2.9396 0 -3.1820 0 -2.4749
Examples are given for transforms taken to the 1st, 2nd and third levels. To
best illustrate what is happening with the wavelet transform, a series of
results are generated at different levels of the transform using the options
-d2 -n3. Under these conditions the smoothed result is just the average of
each pair of points in the data series while the detail result is the
difference from this average.
DAUBWAVE TEST.DAT -d2 -n3 -t1
TEST.T21
3 7 2 6 -1 -1 -1 -1
(s) (d)
8
Transforming to two levels is the same as transforming the data once and then
transforming only the smoothed result to obtain a smoothed-smoothed (ss)
result, a detail-smoothed (sd) result and a detail (d) result.
DAUBWAVE TEST.DAT -d2 -n3 -t2
TEST.T22
5 4 -2 -2 -1 -1 -1 -1
(ss) (sd) (d)
Each additional level only operates on the smoothed result from the previous
level. At the maximum level there are just two points that are operated on
which give an overall average (sss) of the data set.
DAUBWAVE TEST.DAT -d2 -n3 -t3
TEST.T23
4.5 0.5 -2 -2 -1 -1 -1 -1
(sss) (ssd) (sd) (d)
2) Inverse, -i#
The inverse of the transformed data can be obtained by using the following
command.
DAUBWAVE TEST.T43 -i
TEST.I43
2 3.9999 5.9999 7.9999 0.9999 2.9999 4.9999 6.9999
To best illustrate the inverse process again use the options -d2 -n3. To
reconstruct the results of the previous level first add the detail to the
smoothed result then subtract the detail from the smoothed result.
Begin with the transformed data.
DAUBWAVE TEST.DAT -d2 -n3 -t1
TEST.T21
3 7 2 6 -1 -1 -1 -1
(s) (d)
DAUBWAVE TEST.DAT -d2 -n3 -i1
TEST.I21
2 4 6 8 1 3 5 7
The first value, 2, is obtained by taking the sum of the first detail result,
-1, with the first smoothed result, 3. The second value, 4, is obtained by
taking the difference of the first detail result, -1, with the first smoothed
result, 3. This process is repeated to reconstruct the rest of the data set.
3) Series, -s#
This option saves each level of the forward transformation into separate
files thus making it easier to correlate features at different levels of the
analysis.
DAUBWAVE TEST.DAT -n3 -s3
TEST.DAT
2.0 4.0 6.0 8.0 1.0 3.0 5.0 7.0 (original)
9
TEST.343
0 -2.25 0 -1.75 (d)
TEST.342
-1.9943 -1.4698 (sd)
TEST.341
0.3873 (ssd)
TEST.340
4.5 (sss)
The first position of the file extension contains the number of the maximum
level of the analysis. The last number of the extension is the particular
level within the analysis.
4) Low Pass Filter, -l#
This option performs a low pass filter on the data set by calculating the
forward transform of the data and then setting the detail portion equal to
zero. The inverse transform then gives a result which has the high frequency
portion of the data removed. If the low pass filter is performed at the
maximum level, the result will be the average of the data set. Several
examples are given along with their transforms to show which values have been
set to zero.
DAUBWAVE TEST.DAT -l1
TEST.L41
4.0703 2.8047 5.5882 7.2868 3.6618 1.4632 4.6797 6.4453
DAUBWAVE TEST.L41 -t1
TEST.T41
4.6216 9.4258 3.2074 8.2011 0 0 0 0
DAUBWAVE TEST.DAT -l2
TEST.L42
4.4291 4.7645 4.9063 5.0999 4.5709 4.2355 4.0938 3.9001
DAUBWAVE TEST.L42 -t2
TEST.T42
9.7745 8.2255 0 0 0 0 0 0
DAUBWAVE TEST.DAT -l3
TEST.L43
4.5 4.5 4.5 4.5 4.5 4.5 4.5 4.5
DAUBWAVE TEST.L43 -t3
TEST.T43
12.7279 0 0 0 0 0 0 0
One thing to notice is that because of a wrap around effect the first value
in the filtered result is influenced by the last value in the data series
thus causing it to be large compared to its initial value.
5) High Pass Filter, -h#
By specifying the -h# option a high pass filter will be applied. As in the
low pass filter a portion of the transformed data set is set to zero. In
this case the smoothed data is set to zero after the forward transform.
10
Applying this filter to the maximum level effectively removes the mean of the
data.
DAUBWAVE TEST.DAT -h1
TEST.H41
-2.0703 1.1953 0.4118 0.7132 -2.6618 1.5368 0.3203 0.5547
DAUBWAVE TEST.H41 -t1
TEST.T41
0 0 0 0 0 -3.1820 0 -2.4749
DAUBWAVE TEST.DAT -h2
TEST.H42
-2.4291 -0.7645 1.0938 2.9001 -3.5709 -1.2355 0.9063 3.0999
DAUBWAVE TEST.H42 -t2
TEST.T42
0 0 -3.9886 -2.9396 0 -3.1820 0 -2.4749
DAUBWAVE TEST.DAT -h3
TEST.H43
-2.5 -0.5 1.5 3.5 -3.5 -1.5 0.5 2.5
DAUBWAVE TEST.H43 -t3
TEST.T43
0 1.0953 -3.9886 -2.9396 0 -3.1820 0 -2.4749
6) Band Pass Filter, -b#
By specifying the -b# option a band pass filter will be applied. The
transform is performed to the specified level and then the smoothed and
detail data from other levels are set to zero. There is no difference in
results for the specific cases of -b1 and -h1.
DAUBWAVE TEST.DAT -b1
TEST.B41
-2.0703 1.1953 0.4118 0.7132 -2.6618 1.5368 0.3203 0.5547
DAUBWAVE TEST.B41 -t1
TEST.T41
0 0 0 0 0 -3.1820 0 -2.4749
DAUBWAVE TEST.DAT -b2
TEST.B42
-0.3589 -1.9598 0.6820 2.1869 -0.9091 -2.7723 0.5860 2.5452
DAUBWAVE TEST.B42 -t2
TEST.T42
0 0 -3.9886 -2.9396 0 0 0 0
DAUBWAVE TEST.DAT -b3
TEST.B43
-0.0709 0.2645 0.4063 0.5999 0.0709 -0.2645 -0.4063 -0.5999
DAUBWAVE TEST.B43 -t3
11
TEST.T43
0 1.0953 0 0 0 0 0 0
7) Notch Filter, -k#
By specifying the -k# option a notch filter will be applied. The transform
is performed to the specified level and then the detail data from that
particular level is set to zero. There is no difference in results for the
specific cases of -k1 and -l1.
DAUBWAVE TEST.DAT -k1
TEST.K41
4.0703 2.8047 5.5882 7.2868 3.6618 1.4632 4.6797 6.4453
DAUBWAVE TEST.K41 -t1
TEST.T41
4.6216 9.4258 3.2074 8.2011 0 0 0 0
DAUBWAVE TEST.DAT -k2
TEST.K42
2.3589 5.9598 5.3180 5.8131 1.9091 5.7723 4.4140 4.4549
DAUBWAVE TEST.K42 -t2
TEST.T42
9.7745 8.2255 0 0 0 -3.1820 0 -2.4749
DAUBWAVE TEST.DAT -k3
TEST.K43
2.0709 3.7355 5.5938 7.4001 0.9291 3.2645 5.4063 7.5999
DAUBWAVE TEST.K43 -t3
TEST.T43
12.7279 0 -3.9886 -2.9396 0 -3.1820 0 -2.4749
F. Other
1) Rotate, -r
Using the -r option, the results from the different levels of the analysis
are rotated so that their relative position matches features in the original
data set. The amount of rotation depends on the wavelet type and whether the
smoothed or detail portion of the transform is considered. The best way to
illustrate this is to generate a data series which consists of all zeros
except for a single value of one. The following result is for D12 and a
comparison is made with the original data, the rotated and non-rotated data.
To show the effect of starting on the odd position of the data, the -1 option
is also used.
DAUBWAVE TEST.DAT -n3 -s1 (Opt)
Opt (none) (-1) (-r) (-r -1)
data (s) (d) (s) (d) (s) (d) (s) (d)
0 -.0316 .3153 .0275 .226 .0048 -.0011 .0006 0
0
0 .0975 -.1298 -.1298 -.10 -.0316 0 .0275 0
0
0 -.2263 .0275 .3153 .032 .0975 0 -.1298 -.11
12
0
0 .7511 .0006 .4946 -.01 -.2263 .4946 .3153 -.75
0
1 .1115 -.0011 0 0 .7511 .3153 .4946 .226
0
0 0 0 0 0 .1115 -.1298 0 -0.10
0
0 0 0 -.0011 -.11 0 .0275 0 .032
0
0 .0048 .4946 .0006 -.75 0 .0006 -.0011 -.01
0
It can be seen that when rotation of the results is made the major
contributions of the analysis match up with the value of 1 in the original
data set.
2) Shift by 1, -1
The -1 option allows data to be shifted one position to the left before the
analysis takes place. This effectively analyzes the data starting on odd
positions within the data as opposed to even positions which is the standard
way of doing the transform. The result will be different but can still be
used to reconstruct the original data set. Notice the difference in values
with this simple change in the analysis.
DAUBWAVE TEST.DAT -d2 -n3 -t1 -1
TEST.T21
5 4.5 4 4.5 -1 3.5 -1 2.5
(s) (d)
DAUBWAVE TEST.DAT -d2 -n3 -t1
TEST.T21
3 7 2 6 -1 -1 -1 -1
(s) (d)
3) Unix Redirection, -u
The -u option forces the program to receive input from the standard input
device and to send the output to the standard output device. This makes it
possible to run the program using unix redirection and piping. Error
messages are sent to the standard error device.
DAUBWAVE -t <TEST.DAT >DATA.OUT
DATA.OUT
12.7279 1.0953 -3.9886 -2.9396 0 -3.1820 0 -2.4749
4) Compression, -c
The -c option causes the input file to be opened as binary and the results
are saved as a binary file. The numbers are saved in the IEEE floating point
format. This option is not illustrated here and may not be available on the
program you have received.
III. Program Cautions
A. Round Off Error.
The wavelet transform in this program is calculated in single precision
floating point to reduce the amount of memory required to do transforms on
13
very large data sets. If precision is more important, the code can be easily
converted to double precision.
B. Zero Padding
DAUBWAVE operates on data sets which have a length which is equal to a
power of two (2, 4, 8, 16, 32, 64, 128, ...). If the data set does not match
this criteria, the data set is zero padded at the end to make it meet this
criteria. Any output will then have the length of the zero padded data set.
C. Wrap Around
Since the wavelet function has a finite width, it will extend beyond the end
of the data set when a calculation is done near the ends of the data set. If
zeros are assumed to exist beyond the ends of the data set, there will be a
loss of information when the data set is reconstructed from the transform.
To avoid this problem, the last position of the data set is assumed to be
adjacent to the first position of the data set. This wrap around of the data
will show up in such actions as the low pass filter where the last value of
the data set will affect the first value of the data set. This wrap around
effect is assumed at each level of the transform. Therefore, the higher the
level of the transform the larger the end effects due to wrap around.
D. Option Usage
One advantage of using an orthogonal wavelet transform is that the original
data can be reconstructed from the transform without any loss of data. Care
must be taken to ensure that the same options are used for the inverse as
with the forward transform. If the default method is used for generating the
file name, three of the options are coded into the extension. This can be
helpful when trying to transform the data back to its original form. Options
which can affect the transform and are not coded into the extension are the
normalization, shift by one, rotation to correlate the different levels and
compress data by saving it in binary form.
Conclusion
This program has been written during the course of my research in Atmospheric
Science. If there are any bugs or problems with the program or
documentation please contact me. If you have ideas of useful options for the
program, please let me know by writing to me at the following address.
Steven Gollmer
Civil Building
Dept EAS
Purdue University
West Lafayette, Indiana 47907
Phone: (317) 494-0663
email: nls@mace.cc.purdue.edu
The following are acknowledgements for support during the time of this
program's development.
NSF Grant ATM-8909870
USRA Graduate Student Program in the Earth Sciences (Summer 1991)
NASA Graduate Researchers Program Fellowship (1992) NGT-50963
I would also like to acknowledge my advisor and mentor at NASA.
14
Dr. Harshvardhan
Dept Earth and Atmospheric Sciences
Purdue University
West Lafayette, IN
Dr. Robert Cahalan
Laboratory of Atmospheres
Goddard Space Flight Center/NASA
Greenbelt, MD
15